import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Shangji3 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException {
        Class clz = Class.forName("entity.Person");

        Method getAge = clz.getDeclaredMethod("getAge",null);
        getAge.setAccessible(true);

        Object returnAge = getAge.invoke(null, null);

        System.out.println("年龄是："+returnAge);

        Object person = clz.newInstance();

        Method silentMethod = clz.getDeclaredMethod("silentMethod",null);

        silentMethod.setAccessible(true);

        silentMethod.invoke(person,null);

    }
}